<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>用户添加修改</title>
    <link href="bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet" th:href="@{/bootstrap-3.3.7-dist/css/bootstrap.min.css}">
    <link href="css/common.css" rel="stylesheet" th:href="@{/css/common.css}">
    <script type="text/javascript" src="js/jquery-1.12.4.min.js" th:src="@{/js/jquery-1.12.4.min.js}"></script>
    <script src="bootstrap-3.3.7-dist/js/bootstrap.min.js" th:src="@{/bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
    <script src="jquery-validation-1.14.0/lib/jquery.js" th:src="@{/jquery-validation-1.14.0/lib/jquery.js}"></script>
    <script src="jquery-validation-1.14.0/dist/jquery.validate.min.js" th:src="@{/jquery-validation-1.14.0/dist/jquery.validate.min.js}"></script>
    <!-- 引入bootstrap-fileinput -->
	<link th:href="@{/bootstrap-fileinput/fileinput.min.css}" rel="stylesheet"/>
	<script th:src="@{/bootstrap-fileinput/fileinput.min.js}"></script>
    <script type="text/javascript">
    </script>
</head>

<body>
    <br>
    <!--
    <ol class="breadcrumb">
        <li class="active">添加数据</li>
    </ol>-->
<div class="container-fluid"><br>
    <form id="inputForm" action="/admin/saveSet" method="post" class="form-horizontal"  enctype="multipart/form-data">
		
		<div class="form-group" id="roleSelect">
				<label for="pic" class="col-sm-2 control-label">公众号LOGO</label>
   				<div class="col-sm-6">
					<input id="urlLink" name="applogo"  th:value="${appsetinfo.applogo}" class="form-control" type="hidden">
                    <input type="file" id="uploadfile" class="file-loading" multiple="multiple">
				</div>
			</div>
		
		<!-- <div class="form-group" id="isBlock">
            <label for="tel" class="col-sm-2 control-label">公众号APPID<b class="error">*</b></label>
            <div class="col-sm-6">
                <input name="appid" th:value="${appsetinfo.appid}" class="form-control "/>
            </div>
        </div>
        
        <div class="form-group" id="isBlock">
            <label for="tel" class="col-sm-2 control-label">公众号密钥<b class="error">*</b></label>
            <div class="col-sm-6">
                <input name="appkey" th:value="${appsetinfo.appkey}" class="form-control "/>
            </div>
        </div> -->
		
		<div class="form-group" id="isBlock">
            <label for="email" class="col-sm-2 control-label">畅言评论代码<b class="error">*</b><br>
            	<a href="http://changyan.kuaizhan.com/" target="_blank">获取代码</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </label>
            <div class="col-sm-6">
                <textarea name="commentCode" rows="10" cols="" th:text="${appsetinfo.commentCode}"
                 class="form-control " placeholder="请正确填入您的畅言平台安装代码"></textarea>
            </div>
        </div>  
        
        <div class="form-group" id="isBlock">
            <label for="email" class="col-sm-2 control-label">百度统计代码<b class="error">*</b><br>
            	<a href="https://ziyuan.baidu.com/inbound/deadlink" target="_blank">获取代码</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </label>
            <div class="col-sm-6">
                <textarea name="baiduCount" rows="10" cols="" th:text="${appsetinfo.baiduCount}"
                 class="form-control " placeholder="请正确填入您的百度统计网站提交代码的js，方便搜索引擎收录您的网站"></textarea>
            </div>
        </div>

        <div class="form-group" id="isBlock">
            <label for="qqchatUrl" class="col-sm-2 control-label">qq客服链接<b class="error">*</b><br>
                <a href="https://shang.qq.com/v3/index.html">获取链接</a>
            </label>
            <div class="col-sm-6">
                <input name="qqchatUrl" th:value="${appsetinfo.qqchatUrl}" class="form-control " placeholder="https://wpa.qq.com/msgrd?v=3&uin=你的qq号&site=qq&menu=yes"/>
            </div>
        </div>
        
        <div class="form-group" id="roleSelect">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-6">
               <button class="btn btn-success" type="submit">保 存</button>
                <button class="btn btn-inf" type="button" onclick="javascript:history.go(-1);">返 回</button>
            </div>
        </div>



    </form>
    </div>
</body>

<script type="text/javascript">
		
	$("#uploadfile").fileinput({
	    language: 'zh', //设置语言
	    uploadUrl: "/upload/pic", //上传的地址，改成自己的
	    allowedFileExtensions: ['jpg', 'gif', 'png'],//接收的文件后缀
	    initialPreviewAsData:true,
	    initialPreview: $("#urlLink").val(),//vm.cmsVideoProduct.tcpPic这是avalon定义好，在getById里面已经赋值，取回显路径，不要直接复制
	    /* initialCaption: row.fileName, */
	    uploadAsync: true, //默认异步上传
	    showUpload: true, //是否显示上传按钮
	    showRemove : true, //显示移除按钮
	    showPreview : true, //是否显示预览
	    showCaption: false,//是否显示标题
	    browseClass: "btn btn-primary", //按钮样式     
	    dropZoneEnabled: false,//是否显示拖拽区域
	    maxFileCount: 5, //表示允许同时上传的最大文件个数
	    maxFileSize:2 *1024 *1024,
	    messages: {maxFileSize:'文件上传的最大大小为 2MB',acceptFileTypes:'此文件是不支持的图片格式'    },
	    enctype: 'multipart/form-data',
	    validateInitialCount:true
	});
	
	//导入文件上传完成之后的事件
    $("#uploadfile").on("fileuploaded", function (event, data, previewId, index) {
        var response = data.response;
        /* $("#fileMd5").val(response.fileMd5); */
        $("#version").val(response.fileName);
        $("#url").val(response.filePath);
        $("#urlLink").val(response.filePath);
        /* var imgPath = $("#urlLink").val();
        if(imgPath!=null && imgPath !=''){
        	$("#urlLink").val(imgPath+"|"+response.filePath);
        }else{
        	$("#urlLink").val(response.filePath);
        } */
    });
	
	$('#uploadfile').on('filepreupload', function(event, data, previewId, index) {
	   var form = data.form, files = data.files, extra = data.extra,
	    response = data.response, reader = data.reader;
	});
	
	</script>

</html>